#ifndef UTILS_H
#define UTILS_H
#include<iostream>
#include<vector>
#include<string>
#include <chrono>
#include <fstream>
#include <experimental\filesystem>
#include <regex>
#include "opencv2\opencv.hpp"
#include "FaceRecognizer.h"

using std::string;
using std::vector;
using std::pair;
using cv::Mat;

class DataLoader
{
public:
	static void save_face_image(Mat frame, Mat detect_region, const std::vector<cv::Point2f>& landmarks, const std::pair<std::string, float>& person_info , const string& file_path = ".. / face_images / ");
	static void save_face_image(Mat face_img, Mat body_img, const std::pair<std::string, float>& person_info, const string& file_path);
	
	static void load_face_db(const string& face_db_folder, const string& face_db_file, fr::FaceRecognizer* face_classifier, const std::vector<std::string>& mtcnn_params);
private:
	static void record_oneline(std::fstream& output_file, const std::string& person_name, const vector<float>& feature);
	static pair<std::string, vector<float>> process_oneline(const std::string& str);
	static string get_name_from_filename(const string& image_name);
	static vector<pair<string, string>> load_facedb(const string& root_dir);
};

#endif // !UTILS_H

